<?php
namespace app\tp\model;  //app 不能改
use think\Model;
use page;
class Test extends Model
// stock_table_info 这样的表名的驼峰命名法是TableInfo
{

 
  
  
  

 public function index1(){
  return $this->select();

 }

 public function index2($up)
 {
 
 $res = $this->create($up); 
 dump($res);
 dump($res->id);
 echo"上面来自model层,creat方法 返回对象，可查返回值 如id";
 return $res;
}

public function index3($up)
 {
 
 $res = $this->save($up); 
 return $res;
}

public function index4($up)
 {
    $res = $this->update($up);
     return  $res;
}

public function index5($up,$map)
 {
    $res = $this->where($map)->update($up);
    return $res;
}
/**
 *批量修改 
 */
public function index6($up){
$res = $this->saveAll($up);
return $res;
}


/**
 * 删除
 */
public function index7($up){
    $res = $this->destroy($up);
	return $res;
}

/**
 * 删除
 */
public function index8($map){
    $res = $this->where($map)->delete();
	return $res;
}

/**
 * 统计 总数
 */
public function index9($map){
  return $this->where($map)->count();

}


/**
 * 统计 字段最大值
 */
public function index10($map,$column){
   
        return $this->where($map)->max($column);
        
  
  }
/**
 * 查询 select
 */
  public function select($where,$order,$limit,$field){  //多参数的写法($where,$order,$item)
 echo" 来自model的说明：控制器 index48 index60 index64 index68 index70 inex74使用<br/>";
     return $this->where($where)->order($order)->limit($limit)->field($field)->select();
     
  }


  public function select1($column){
      echo"来自model的说明：控制器 index51 index63 使用";
    return $this->column($column);

  }

  public function select2($column,$distinct){
      echo"来自model的说明：控制器 index56 使用";
    return $this->Distinct($distinct)->column($column);

  }

  public function select3($group,$column){
    echo"来自model的说明：控制器 index58 使用";
    return $this->group($group)->column($column);

  }



}